//
//  MineTableViewCell.swift
//  KkmhSwift
//
//  Created by tenltrs on 2018/11/14.
//  Copyright © 2018 Tenltrs. All rights reserved.
//

import UIKit

class MineTableViewCell: UITableViewCell,Reusable {
    
    private var iconView : UIImageView!
    
    private var titleLabel : UILabel!
    
    private var moreView : UIImageView!
    
    private var line : UIView!

    override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        
        iconView = UIImageView.init()
        contentView.addSubview(iconView)
        iconView.snp.makeConstraints { (make) in
            make.centerY.equalToSuperview()
            make.left.equalToSuperview().offset(15)
        }
        
        titleLabel=UIViewTool.mas_label(text: "", textColor: UIColor.BLACK3TEXTCOLOR, textAligment: NSTextAlignment.left, fontSize: 15)
        contentView.addSubview(titleLabel)
        titleLabel.snp.makeConstraints { (make) in
            make.left.equalTo(iconView.snp.right).offset(10)
            make.centerY.equalToSuperview()
        }
        
        moreView=UIViewTool.mas_imageView(backColor: nil, imageName: "ic_me_more_arrow_normal_7x12_")
        contentView.addSubview(moreView)
        moreView.snp.makeConstraints { (make) in
            make.right.equalToSuperview().offset(-15)
            make.centerY.equalToSuperview()
            make.size.equalTo(moreView.image!.size)
        }
        
        line = UIViewTool.mas_view(backColor: UIColor.LineColor)
        contentView.addSubview(line)
        line.snp.makeConstraints { (make) in
            make.left.equalTo(titleLabel)
            make.right.equalTo(moreView)
            make.bottom.equalToSuperview()
            make.height.equalTo(1)
        }
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    
    func fillData(dict : [String : String], indexPath : IndexPath, isSectionLast : Bool){
    
        iconView.image=UIImage(named: dict["icon"]!)
        titleLabel.text=dict["title"]
        line.isHidden=isSectionLast
    }

}
